#pragma once
#ifndef CENTRAL_CACHE_H_
#define CENTRAL_CACHE_H_
#include"Common.h"
#include"ObjectPool.h"
class CentralCache{
    public:
      static CentralCache* getinstance(){
          return &_sInst;
      }
      //获取一个非空的span给threadcache
      Span* GetoneSpan(SpanList&list,size_t byte_size);
      //获取一定数量的对象给threadcache
      size_t FetchRangeObj(void*&start,void*&end,size_t n,size_t byte_size);
      //将一定数量的对象释放到Span跨度
      void ReleaseListSpans(void*start,size_t byte_size);
    private:
      SpanList _spanLists[MAX_FREELIST];
      static CentralCache _sInst;
      CentralCache();
      CentralCache(CentralCache const&) = delete;
      void operator=(CentralCache const&) = delete;

};
#endif //CENTRAL_CACHE_H_